package com.lianzhihui.romeex.adapter;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.lianzhihui.romeex.R;
import com.lianzhihui.romeex.bean.MnnerTransferListBean;
import com.lianzhihui.romeex.utils.DateUtil;
import com.lianzhihui.romeex.utils.NumberUtils;

import java.util.List;

/**
 * Description: 主页适配器
 * Author: RAMON
 * CreateDate: 2020/11/4 8:10 PM
 * UpdateUser:
 * UpdateDate:
 * UpdateRemark:
 * Version:
 */
public class NodeBuyAdapter extends BaseQuickAdapter<MnnerTransferListBean.ContentBean, BaseViewHolder> {

    public NodeBuyAdapter(@Nullable List<MnnerTransferListBean.ContentBean> data) {
        super(R.layout.item_nodebuy_layout, data);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, MnnerTransferListBean.ContentBean item) {
        helper.setText(R.id.item_name, DateUtil.sec2Date(item.getTimeStamp()));
        String temp = "";
        if (Double.parseDouble(item.getBalance()) > 0) {
            temp = "+" + NumberUtils.big8(Double.parseDouble(item.getBalance()));
        } else {
            temp = NumberUtils.big8(Double.parseDouble(item.getBalance()));
        }
        helper.setText(R.id.item_float, temp);
    }
}
